Here are some CLUE calisthenics to limber you up. Some of them
will require further study of CLUE, CLX, and the X Window System. Some of them
are rather challenging.
- Complete the blinker contact example. Write a display method
that will fill the blinker with its color when its on-p
state is
true and fill it with its background otherwise. Ensure
that the blinker-on-p accessor updates the display correctly.
- Create two blinker instances — one that will print out either
``Off!'' when
its :blink callback is called with a nil argument or ``On!''
otherwise, and another which will make a funny noise on your Explorer only
when its :blink callback is called with a non-nil argument.
- Try out different contact attributes on your blinker. For example,
try a different border-width, border, and background. Try
initializing the background to a '(float 0 1) value. What happened?
Why?
- Define resources to change initial blinker attributes.
- Create two ``funny noise'' blinker instances, as in the previous
exercise, but give them different funny noises. Do not change the
definition of the blinker class.
- Change the blinker class so that whenever the cursor enters a blinker, it turns into a picture of Gumby. Hint: use the xfd program
(font displayer) to find an appropriate element of the cursor font.
Another hint: Use ``man xfd'' to learn how to use xfd.
- Change the blinker class to include a string slot, containing
a string which can be displayed in any font. Display the string so that it
appears in the blinker's color, is centered horizontally and
vertically within the blinker's current interior size, and is visible
regardless of the blinker's on-p state. Ensure that the string
remains centered when the user changes the font or the size of the blinker.
- Define a composite class that always has a single blinker
child, which is always centered horizontally and vertically within the composite. Ensure that the blinker child
remains centered when the user changes the size of the composite.
- Define an etch-a-sketch contact that will:
- Rubberband a horizontal
line as the user moves the pointer with :button-1 down, then
snap it into place when the button is released.
- Rubberband a vertical
line as the user moves the pointer with :button-2 down, then
snap it into place when the button is released.
- Print out a copy of its current line drawing on the Imagen
when the #
\return key is pressed.